import dayjs from 'dayjs'
import SidebarNoteItemContent from './SidebarNoteItemContent.jsx'
export default function SidebarNoteItem({ note, noteId }) {
  const { title, updateTime, content = '' } = note
  return (
    <SidebarNoteItemContent id={noteId} title={title} expandedChildren={<p className='sidebar-note-excerpt'>{content.substring(0, 20) || <i>(no content)</i>}</p>}>
      <header className='sidebar-note-header'>
        <strong>{title}</strong>
        <small>{dayjs(updateTime).format('YYYY-MM-DD hh:mm:ss')}</small>
      </header>
    </SidebarNoteItemContent>
  )
}